/*
 * @Author: Otway
 * @Date: 2019-01-09 11:16:08
 * @LastEditors: Otway
 * @LastEditTime: 2019-08-30 18:50:09
 * @copyright: h-visions
 */
import React, { Component } from 'react';
import {
  Row,
  Col,
  Form,
  Input,
  Radio,
  Alert,
} from 'antd'; 
const FormItem = Form.Item;
const formItemLayout = {
  // 抽屉里面Form。二列的布局比例
  labelCol: {
    span: 8 
  },
  wrapperCol: {
    span: 16 
  }
};

class AddFrom extends Component {
  render() {
    const {
      form: { getFieldDecorator },
    } = this.props;
    return (
      <Form >
        <Alert message={<span>只有系统管理员才能配置新的钉钉推送功能，用户自行配置是无效的。</span>} type="info" showIcon style={{ marginBottom: 15 }} />
        <Row>
          <Col span={24}>
            <FormItem {...formItemLayout} label={'功能编码'}>
              {getFieldDecorator('functionCode', {
                rules: [
                  {
                    required: true,
                    message: '请填写功能编码'
                  }
                ]
              })(<Input />)}
            </FormItem>
          </Col>
          <Col span={24}>
          <FormItem {...formItemLayout} label={'功能名称'}>
              {getFieldDecorator('functionName', {
                rules: [
                  {
                    required: true,
                    message: '请填写功能名称'
                  }
                ]
              })(<Input />)}
            </FormItem>
          </Col>
          <Col span={24}>
          <FormItem {...formItemLayout} label={'描述'}>
              {getFieldDecorator('describe', {
                rules: [
                  {
                    required: true,
                    message: '请输入描述'
                  }
                ]
              })(<Input />)}
            </FormItem>
          </Col>
          <Col span={24}>
          <FormItem {...formItemLayout} label={'推送类型'}>
              {getFieldDecorator('pushType', {
                initialValue: 2,
                rules: [
                  {
                    required: true,
                    message: '请选择推送类型'
                  }
                ]
              })(<Radio.Group>
                <Radio value={1}>个人</Radio>
                <Radio value={2}>群</Radio>
                <Radio value={3}>个人和群</Radio>
              </Radio.Group>)}
            </FormItem>
          </Col>
          <Col span={24}>
          <FormItem {...formItemLayout} label={'状态'}>
              {getFieldDecorator('status', {
                initialValue: 0,
                rules: [
                  {
                    required: true,
                    message: '请选择状态'
                  }
                ]
              })(<Radio.Group>
                <Radio value={0}>启用</Radio>
                <Radio value={1}>停用</Radio>
              </Radio.Group>)}
            </FormItem>
          </Col>
        </Row>
      </Form>
    );
  }
}

export default Form.create()(AddFrom);
